﻿using MediatR;
using SystemHYS.API.Application.command.GualityGroupCommand;
using SystemHYS.Infrstructre.Interface;

namespace SystemHYS.API.Application.commandler.GualityGroupCommandler
{
    public class GualityGroupCreateCommandler:IRequestHandler<GualityGroupCreateCommand,int>
    {
        IGualityGroupRepository GroupRepository;
        public GualityGroupCreateCommandler(IGualityGroupRepository GroupRepository)
        {
            this.GroupRepository = GroupRepository;
        }

        public async Task<int> Handle(GualityGroupCreateCommand request, CancellationToken cancellationToken)
        {

            return await GroupRepository.AddAsyn(new Domian.GualityGroup()
            {
                gualityGroupName=request.gualityGroupName,
                gualityGroupNumbering=request.gualityGroupNumbering,
                gualityGroupRemark=request.gualityGroupRemark,
                AddName= "李明",
                AddTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).ToUniversalTime(),
            });
        }
    }
}
